1. Field of the Invention
The invention relates in general to a computer field, and more particularly to a detection method and apparatus for hot-swapping of a Secure Digital (SD) card.
2. Description of the Related Art
A Secure Digital (SD) memory card (to be referred to as an SD card) is commonly converted to be operable as a Universal Serial Bus (USB) device through an SD card reader. When an SD card is removed from an SD card reader that is still plugged to a USB interface of a system, a Linux operating system cannot detect such hot-swapping event of the SD card.
In practice, when an SD card is removed from an SD card reader by a user, upper-layer applications of an operating system are unaware of the removal of the SD card. The upper-layer systems, stilling considering the SD card readable and writable, may continue to access the SD card. However, read and write failures are caused as data cannot be read from or written to the non-existent SD card.
Therefore, application confusions are often resulted as hot-swapping events are not in real-time detected.